package model;

/**
 * This is a builder class for Filter.
 * 
 * The filter builder class uses the builder design pattern to create an filter object with 
 * multiple parameters.
 * @author Sukhjinder K. Narula
 * @since June 2013
 * @version $Revision: 1.0 $
 */

public class FilterBuilder 
{
	/**
	 * properties for the class filter
	 */
	int id;
	int userId;
	String to;
	String title;
	String from;
	String body;
	String subject;
	int folderId;
	 
	 /**
	  * Parameterless Constructor
	  */
	 public FilterBuilder(){
		 id = -1;
		 userId = 0;
		 title = "";
		 to = "";
		 from = "";
		 body = "";
		 subject="";
		 folderId = 0;
	 }

	 /**
	 * Sets the filter user id field
	
	
	 * @param userId int
	  * @return current filter builder object. */
	 public FilterBuilder setUserId(int userId) {
		this.userId = userId;
		return this;
	 }
	
	 /**
	  * Sets the filters title field 
	 
	 
	  * @param title String
	  * @return current filter builder object. */
	public FilterBuilder setTitle(String title) {
		this.title = title;
		return this;
	}


	/**
	  * Sets the filters to field 
	 
	 
	  * @param to String
	 * @return current filter builder object. */
	public FilterBuilder setTo(String to) {
		this.to = to;
		return this;
	}

	/**
	  * Sets the filters from field 
	 
	 
	  * @param from String
	 * @return current filter builder object. */
	public FilterBuilder setFrom(String from) {
		this.from = from;
		return this;
	}
	
	/**
	  * Sets the filters body field 
	 
	 
	  * @param body String
	 * @return current filter builder object. */
	public FilterBuilder setBody(String body) {
		this.body = body;
		return this;
	}
	
	/**
	 * Sets the filter folder id field
	
	
	 * @param folderId int
	 * @return current filter builder object. */
	 public FilterBuilder setFolderId(int folderId) {
		this.folderId =folderId;
		return this;
	 }
	 
	 /**
	  * Sets the filters subjecy
	  * @param sub 
	  * @return
	  */
	 public FilterBuilder setSubject(String sub) {
		this.subject =sub;
		return this;
	 }
	 
		
	/**
	 * Build and return the filter object
	
	 * @return filter object that has been built. */
	public Filter build(){
		return new Filter(this.userId, this.title, this.to, this.from, this.body, this.subject,this.folderId);
	}

	/**
	 * Resurns the filter id
	
	 * @return filter id */
	public int getId() {
		return id;
	}

	/**
	 * Sets the filter id
	 * @param id filter if
	 */
	public void setId(int id) {
		this.id = id;
	}
	/**
	 * Returns the user id
	
	 * @return user Id */
	public int getUserId() {
		return userId;
	}
	/**
	 * Returns the to field
	
	 * @return to field */
	public String getTo() {
		return to;
	}
	/**
	 * Returns the title
	
	 * @return title field */
	public String getTitle() {
		return title;
	}
	/**
	 * Returns the from field
	
	 * @return from field */
	public String getFrom() {
		return from;
	}
	/**
	 * Returnd the body field
	
	 * @return the body field */
	public String getBody() {
		return body;
	}
	/**
	 * Returns the folder id fields
	
	 * @return folder id */
	public int getFolderId() {
		return folderId;
	}

	


}
